use ADP 
go


/*
IF OBJECT_ID ( 'ADPUser', 'U' ) IS NOT NULL 
    DROP table ADPUser;
GO
CREATE table ADPUser
(
UserName nvarchar(50) not null,
Password nvarchar(50),
UserLevel int
)--*/



IF OBJECT_ID ( 'User_Insert', 'P' ) IS NOT NULL 
    DROP PROCEDURE User_Insert;
GO
CREATE PROCEDURE User_Insert
    @UserName nvarchar(50),
	@Password nvarchar(50),
	@UserLevel int
AS    
    insert into ADPUser(UserName,Password,UserLevel)
    values(@UserName,@Password,@UserLevel) 
GO 



IF OBJECT_ID ( 'User_Update', 'P' ) IS NOT NULL 
    DROP PROCEDURE User_Update;
GO
CREATE PROCEDURE User_Update
    @UserName nvarchar(50),
	@Password nvarchar(50),
	@UserLevel int
AS    
    update ADPUser set Password=@Password,UserLevel=@UserLevel 
    where UserName=@UserName
GO 


IF OBJECT_ID ( 'User_Delete', 'P' ) IS NOT NULL 
    DROP PROCEDURE User_Delete;
GO
CREATE PROCEDURE User_Delete
    @UserName nvarchar(50)
AS    
    delete from ADPUser 
    where UserName=@UserName
GO 


-------------------------------------------------------------------------------------

IF OBJECT_ID ( 'User_SelectAll', 'P' ) IS NOT NULL 
    DROP PROCEDURE User_SelectAll;
GO
CREATE PROCEDURE User_SelectAll
AS    
    select UserName,Password,UserLevel from ADPUser 
GO 



IF OBJECT_ID ( 'User_Select', 'P' ) IS NOT NULL 
    DROP PROCEDURE User_Select;
GO
CREATE PROCEDURE User_Select
    @UserName nvarchar(50)
AS    
    select UserName,Password,UserLevel from ADPUser 
    where UserName=@UserName
GO 









select * from ADPUser 













